package com.xiliu.server.modules.basicdata.service.impl;

import java.util.List;
import java.util.Arrays;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiliu.server.modules.app.vo.HouseConfigVo;
import com.xiliu.server.modules.basicdata.entity.XlHouseConfig;
import com.xiliu.server.modules.basicdata.mapper.XlHouseConfigMapper;
import com.xiliu.server.modules.basicdata.service.IXlHouseConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 房源配套配置表Service业务层处理
 * 
 * @author xiliu
 * @date 2022-11-11
 */
@Service
public class XlHouseConfigServiceImpl extends ServiceImpl<XlHouseConfigMapper, XlHouseConfig> implements IXlHouseConfigService {
    @Autowired
    private XlHouseConfigMapper xlHouseConfigMapper;

    /**
     * 查询房源配套配置表
     * @param houseConfigId 房源配套配置表主键
     * @return 房源配套配置表
     */
    @Override
    public XlHouseConfig selectXlHouseConfigByHouseConfigId(Long houseConfigId) {
        return xlHouseConfigMapper.selectXlHouseConfigByHouseConfigId(houseConfigId);
    }

    /**
     * 查询房源配套配置表列表
     * @param xlHouseConfig 房源配套配置表
     * @return 房源配套配置表
     */
    @Override
    public List<XlHouseConfig> selectXlHouseConfigList(XlHouseConfig xlHouseConfig) {
        return xlHouseConfigMapper.selectXlHouseConfigList(xlHouseConfig);
    }

    /**
     * 新增房源配套配置表
     * @param xlHouseConfig 房源配套配置表
     * @return 结果
     */
    @Override
    public boolean create(XlHouseConfig xlHouseConfig) {
        return save(xlHouseConfig);
    }

    /**
     * 修改房源配套配置表
     * @param xlHouseConfig 房源配套配置表
     * @return 结果
     */
    @Override
    public boolean update(XlHouseConfig xlHouseConfig) {
        return updateById(xlHouseConfig);
    }

    /**
     * 批量删除房源配套配置表
     * @param houseConfigIds 需要删除的房源配套配置表主键
     * @return 结果
     */
    @Override
    public int deleteXlHouseConfigByHouseConfigIds(Long[] houseConfigIds) {
        return xlHouseConfigMapper.deleteBatchIds(Arrays.asList(houseConfigIds));
    }

    /**
     * 删除房源配套配置表信息
     * @param houseConfigId 房源配套配置表主键
     * @return 结果
     */
    @Override
    public int deleteXlHouseConfigByHouseConfigId(Long houseConfigId) {
        return xlHouseConfigMapper.deleteById(houseConfigId);
    }

    @Override
    public List<HouseConfigVo> getHouseConfigListByName(String configName) {
        return xlHouseConfigMapper.getHouseConfigListByNames(Arrays.asList(configName.split(",")));
    }
}
